<?php

namespace app\services\setting\admin;

use app\dao\setting\admin\SystemRoleDao;
use app\exceptions\AuthException;
use app\services\BaseService;

class SystemRoleService extends BaseService
{

    public function __construct(SystemRoleDao  $dao)
    {
        $this ->dao = $dao;
    }

    public function create(array $where)
    {
        $data =  $this -> dao -> create($where);
        if ($data) return $data['id'];
        throw new AuthException('添加失败');
    }

    public function index(array $where)
    {
        return $this -> dao -> index($where);
    }

    public function update(array $where)
    {
        $data =  $this -> dao -> updateDao($where);
        if ($data) return $data;
        throw new AuthException('修改失败！');
    }

    public function delete(array $where)
    {
       return $this -> dao -> deleteDao($where);
    }

    public function searchTitle(array $where)
    {
        return $this -> dao -> searchTitle( $where);
    }

}